package io.renren.modules.withdraw_cash.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.withdraw_cash.entity.V9WithdrawCashEntity;
import io.renren.modules.withdraw_cash.entity.params.V9WithdrawCashParams;
import io.renren.modules.withdraw_cash.service.V9WithdrawCashService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 佣金提现审核
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-09-19 17:30:23
 */
@RestController
@RequestMapping("withdraw_cash/v9withdrawcash")
public class V9WithdrawCashController {
    @Autowired
    private V9WithdrawCashService v9WithdrawCashService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("withdraw_cash:v9withdrawcash:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = v9WithdrawCashService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{wcId}")
    @RequiresPermissions("withdraw_cash:v9withdrawcash:info")
    public R info(@PathVariable("wcId") Integer wcId){
		V9WithdrawCashEntity v9WithdrawCash = v9WithdrawCashService.getById(wcId);

        return R.ok().put("v9WithdrawCash", v9WithdrawCash);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("withdraw_cash:v9withdrawcash:save")
    public R save(@RequestBody V9WithdrawCashEntity v9WithdrawCash){
		v9WithdrawCashService.save(v9WithdrawCash);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("withdraw_cash:v9withdrawcash:update")
    public R update(@RequestBody V9WithdrawCashEntity v9WithdrawCash){
		v9WithdrawCashService.updateById(v9WithdrawCash);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("withdraw_cash:v9withdrawcash:delete")
    public R delete(@RequestBody Integer[] wcIds){
		v9WithdrawCashService.removeByIds(Arrays.asList(wcIds));

        return R.ok();
    }


/*
* 审核
* */
    @RequestMapping("/pass")
    public R pass(@RequestBody V9WithdrawCashParams params){
        return v9WithdrawCashService.pass(params);
    }

}
